package cate.game.role.login.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBLogin;
import cate.game.role.Role;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "登录检查 の 请求")
public class LoginCheckReq implements MsgInput {

    @NoteField("角色ID")
    public String roleId;

    @Override
    public MsgConfig conf() {
        return MsgIdBLogin.CHECK_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        Role role = game.role.findOnline(this.roleId);
        LoginCheckResp resp = new LoginCheckResp();
        resp.online = role != null && role.getCc() != null;
        cc.sendNow(resp);
    }


}
